Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IR marking laser for aircraft #7761

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Add IR marking laser for aircraft #7761

wants to merge 13 commits into from

Conversation

BaerMitUmlaut
Copy link
Member

@BaerMitUmlaut BaerMitUmlaut commented Jun 14, 2020

When merged this pull request will:

  • Adds an IR marking laser for aircraft, controlled through the pilot camera
  • Idea taken from (Ready) Adds more laser functionality to aircraft #7509 but completely rewritten
  • IR laser is a 10km long light emitting object that is resized to the appropriate length, so it doesn't clip through objects or terrain
  • Laser orientation updates are sent over the network once per second and interpolated clientside

TODO:

  • Blocking issue: setVectorUp with attached objects is not instant, thus the laser doesnt actually touch the ground and is quite shaky when the plane is moving - maybe @dedmen can fix that in engine?
  • Eden checkbox or something similar to manually equip vehicles with it instead of automatically enabling it for every plane with a pilot camera
  • Feedback for the pilot that the laser is active (currently appears invisible because the camera is inside of the laser object, an offset could work but might block the view too much)
  • Epilepsy friendly setting to disable laser flickering
  • Maybe add support for 5km+ line intersection

Screenshot:
20200614225602_1

Reference image (the only one I could find, would love to see more if anybody finds some):

Source

Mainly publishing this as a POC for custom IR lasers, I think the concept is pretty neato.

@BaerMitUmlaut BaerMitUmlaut added kind/feature Release Notes: **ADDED:** status/experimental labels Jun 14, 2020
@dedmen
Copy link
Contributor

dedmen commented Jun 15, 2020

setVectorUp with attached objects is not instant

more details? I would expect delay by a few frames, and then a "instant" flop into position.

@PabstMirror PabstMirror added this to the Ongoing milestone Jun 15, 2020
@Neviothr
Copy link
Contributor

Neviothr commented Jun 2, 2021

https://forums.bohemia.net/forums/topic/140837-development-branch-changelog/?page=58&tab=comments#comment-3438862

Added: irDotSize entry to weapon IR laser attachment config classes for the size of the IR dot on laser impact

Perhaps make the laser's dot bigger, to create more of an area marking laser, rather than a pinpoint one?

@BaerMitUmlaut
Copy link
Member Author

Aircraft don't have weapon attachments...
We can make the laser as big as we want, since everything here is custom and not based on vanilla.

@dedmen
Copy link
Contributor

dedmen commented Sep 3, 2021

Here is my script with the hopefully 2.08 scripted lasers feature
https://gist.github.com/dedmen/61643bd7b7205c13b68bff4b214f5840#file-weaponlaser-sqf-L136

Docs https://community.bistudio.com/wiki/drawLaser

@PabstMirror
Copy link
Contributor

The 3den attribute is weird, it's default value is true.
So if you put a plane down, nothing will be set
if you open attributes it will show being checked, but not set anything

I had to set it to false, which added the attribute to the sqm
then change it back to true to get it to work

@PabstMirror
Copy link
Contributor

UAV's hate having this thing attached, they kept going up in altitude to avoid it

I forget what I did but somehow I ended up with this "burning" spot left, but it eventaully went away after a few seconds
20210922233211_1

@veteran29
Copy link
Member

UAV's hate having this thing attached, they kept going up in altitude to avoid it

Maybe we should wait for 2.08 and use drawLaser?

BaerMitUmlaut and others added 4 commits September 23, 2021 20:44
Co-authored-by: PabstMirror <[email protected]>
Co-authored-by: PabstMirror <[email protected]>
Co-authored-by: PabstMirror <[email protected]>
@BaerMitUmlaut
Copy link
Member Author

UAV's hate having this thing attached, they kept going up in altitude to avoid it

How are you testing this? I tried it with the Yabhon drone and a loiter waypoint at 500 m altitude, which seems to work just fine. That was pretty much the use case I had in mind originally. We could switch to the scripted laser later, if that has the same capability (range would be my main concern), but I would prefer not delaying this PR further unless necessary. 2.06 is already taking quite a while, so I don't expect 2.08 to still arrive this year.

I've fixed the attribute by enabling the laser by default. The bright spot is odd, since that should be part of the model, which is clearly not visible. I'd assume this is caused by some sort of lazy update within the engine. If you can repro it, please let me know.

@dedmen
Copy link
Contributor

dedmen commented Oct 1, 2021

I don't expect 2.08 to still arrive this year.

Thats indeed not planned. rather Q1 2022

@severgun
Copy link
Contributor

Just a reminder that 2.08 already released.

@BrettMayson
Copy link
Member

BrettMayson commented May 16, 2023

  • Switched to drawLaser instead of an object
  • Shows the laser in Zeus night vision

Because drawLaser fades over time, it is a little obvious where the command repeats to extend the range beyond what the engine supports for a single drawLaser call, but I personally think this is pretty minor.
image

addons/markinglaser/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got loads of

21:49:32 Error in expression <EqualTo [] } do {
        _intersects = lineIntersectsSurfaces [_startPos, _endP>
21:49:32   Error position: <lineIntersectsSurfaces [_startPos, _endP>
21:49:32   Error 0 elements provided, 3 expected
21:49:32 File /z/ace/addons/markinglaser/functions/fnc_renderPFH.sqf..., line 357
21:49:32 Error in expression <ivate _elevation = _modelVector#2 atan2 vectorMagnitude [_modelVector # 0, _mode>
21:49:32   Error position: <vectorMagnitude [_modelVector # 0, _mode>
21:49:32   Error Type Any, expected Number
21:49:32 File /z/ace/addons/markinglaser/functions/fnc_renderPFH.sqf..., line 339

being spammed after my plane crashed and I teleported myself out with Zeus (not sure if the teleportation had much of an effect tbh).

params ["_aircraft"];

GVAR(lasers) deleteAt (GVAR(lasers) find _aircraft);
GVAR(localLasers) deleteAt (GVAR(localLasers) find _laser);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_laser is undefined.


GVAR(lasers) pushBack _aircraft;
if (local _aircraft) then {
GVAR(localLasers) pushBack _laser;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

};

if (isServer) then {
_aircraft removeMPEventHandler ["MPKilled", _aircraft getVariable QGVAR(killedEH)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://community.bistudio.com/wiki/removeMPEventHandler

Comment is from 2011, but it worries me a little. Imo we'd be safer using extended CBA EH.

Comment on lines +39 to +45
if (didJIP) then {
{
if (_x getVariable [QGVAR(laserOn), false]) then {
[_x] call FUNC(onLaserOn);
};
} forEach (allMissionObjects "Air");
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not store all lasers on the server, then send them to connecting clients when requested? See the dogtags component for an implementation.

// Keybinds
["ACE3 Vehicles", QGVAR(toggleLaser), LLSTRING(ToggleLaser), {
// Ignore when in Zeus
if (!isNull curatorCamera) exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because previously there was nothing, but we might want to add a CBA registered camera check.

* Public: No
*/

if (GVAR(lasers) isEqualTo []) exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not turn off PFH?

* Public: No
*/

if (GVAR(localLasers) isEqualTo []) exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


// Start PFHs if this is the first laser
if (local _aircraft && {GVAR(updatePFH) == -1}) then {
GVAR(updatePFH) = [LINKFUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GVAR(updatePFH) = [LINKFUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler;
GVAR(updatePFH) = [LINKFUNC(updatePFH), UPDATE_INTERVAL, []] call CBA_fnc_addPerFrameHandler;

@PabstMirror
Copy link
Contributor

Last time I tested this in mp there were big problems with laser position syncing
I might have some ideas how to redo, I'll try to look into this because it is a neat feature

@PabstMirror PabstMirror self-assigned this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:** status/experimental
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants